import 'dart:convert';

import 'package:json_annotation/json_annotation.dart';

part 'qiyu_order.g.dart';

@JsonSerializable(explicitToJson: true)
class QiyuOrder {

  @JsonKey(defaultValue: [])
  List<OrderData> data = [];

  QiyuOrder();

  factory QiyuOrder.fromJson(Map<String, dynamic> json) => _$QiyuOrderFromJson(json);

  Map<String, dynamic> toJson() => _$QiyuOrderToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable(explicitToJson: true)
class OrderData {
  @JsonKey(defaultValue: "")
  String key = "";
  @JsonKey(defaultValue: "")
  String label = "";
  @JsonKey(defaultValue: "")
  String value = "";

  OrderData();

  factory OrderData.fromJson(Map<String, dynamic> json) => _$OrderDataFromJson(json);

  Map<String, dynamic> toJson() => _$OrderDataToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable(explicitToJson: true)
class CustomerEnter {
  @JsonKey(name: "enter_type", defaultValue: 1)
  int enterType = 1; //1 app 2 h5
  @JsonKey(name: "enter_url", defaultValue: "")
  String enterUrl = "";

  CustomerEnter();

  factory CustomerEnter.fromJson(Map<String, dynamic> json) => _$CustomerEnterFromJson(json);

  Map<String, dynamic> toJson() => _$CustomerEnterToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
